package com.example.demo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@ResponseBody
public class UserController {

    // 1. 先得到日志对象(来自 slf4j)
    private final static Logger log =
            LoggerFactory.getLogger(UserController.class);  // 设置当前类的类型

    @RequestMapping("/sayhi")
    public void sayHi(){
        // 2. 使用日志对象提供的打印方法进行日志打印
        log.trace("我是 trace");
        log.debug("我是 debug");
        log.info("我是 info");
        log.warn("我是 warn");
        log.error("我是 error");


    }


}
